function DeleteItemPanierByIndex(index)
{	
	GetPageContent('GET', 'functions/GetDeleteItemPanierByIndexHTML.php?index='+index, '', CallbackDeleteItemPanierByIndex, null, true);
}

function CallbackDeleteItemPanierByIndex(success, text, param)
{
	if(text == '1')
	{
		parent.UptdateNumberItemsPanier();
		location.reload();
	}
	else
		alert(text);
	
	return;
}

function PanierCheckboxClick()
{
	var check = document.getElementById('paniercheckadresse');
	var edit1 = document.getElementById('nom');
	var edit2 = document.getElementById('prenom');
	var edit3 = document.getElementById('adresse1');
	var edit4 = document.getElementById('adresse2');
	var edit5 = document.getElementById('codepostal');
	var edit6 = document.getElementById('ville');
	var edit7 = document.getElementById('pays');
	
	edit1.disabled = check.checked;
	edit2.disabled = check.checked;
	edit3.disabled = check.checked;
	edit4.disabled = check.checked;
	edit5.disabled = check.checked;
	edit6.disabled = check.checked;
	edit7.disabled = check.checked;
}

function PanierSubmitCommande()
{
	return true;
}

function PanierCheckCodePromo()
{
	var codepromo = document.getElementById('input_codepromo');
	var icone = document.getElementById('input_codepromo-icone');
	var divcachee = document.getElementById('panier_zone_cachee');
	
	if(codepromo.value == '')
	{
		divcachee.style.display = 'none';
		icone.className = 'panier_icone_codepromo_aucun';
	}
	else
		GetPageContent('GET', 'functions/GetInfoCodePromo.php?code='+codepromo.value, '', PanierCheckCodePromoCallback, null, true);
		
	return;
}

function PanierCheckCodePromoCallback(success, text, param)
{
	var icone = document.getElementById('input_codepromo-icone');
	var divcachee = document.getElementById('panier_zone_cachee');
	
	if(success)
	{
		if(text == 'Code invalide')
		{
			icone.className = 'panier_icone_codepromo_bad';
			divcachee.style.display = 'none';
		}
		else
		{
			divcachee.style.display = 'block';
			icone.className = 'panier_icone_codepromo_ok';
			divcachee.innerHTML = text;			
		}
	}
	
	return;
} 

function isChecked()
{
	var checkbox = document.getElementById('check');
	
	if(checkbox.checked)
		return true;
	else
	{
		alert('Vous devez accepter les conditions générales de ventes.');
		return false;
	}
}